﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            int i = 0;
            float sum = 0;
           
                for (; ; )
                {
                try
                {
                    Console.WriteLine("请输入{0}学生的成绩", i + 1);
                    float a = float.Parse(Console.ReadLine());
                    if (a == -1)
                    {
                        break;
                    }
                    i++;
                    sum = sum + a;

                }

                catch (FormatException e)
                {
                    Console.WriteLine("异常已处理");
                    Console.WriteLine(e.Message);
                }
                catch (OverflowException e)
                {
                    Console.WriteLine("异常已处理");
                    Console.WriteLine(e.Message);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }
                finally
                {
                    Console.WriteLine("输入结束");
                }
            }
            Console.WriteLine("总学生数"+i);
            Console.WriteLine("总分数"+sum);

            Console.WriteLine("平均分"+(sum/i));
        }
                  
                 }
    

    
}
